{ config, lib, hostnames, pkgs, ... }:

{
  programs.rofi = {
    enable = true;
    extraConfig = {
      modi = "drun";
      show-icons = true;
      display-drun = " ";
    };
  };
  xdg.configFile = {
    "rofi/config.rasi" = {
      text = ''
        * {
            font: "Maple Mono NF CN 15";
            g-spacing: 10px;
            g-margin: 0;
            b-color: #000000FF;
            fg-color: #FFFFFFFF;
            fgp-color: #888888FF;
            b-radius: 8px;
            g-padding: 8px;
            hl-color: #FFFFFFFF;
            hlt-color: #000000FF;
            alt-color: #111111FF;
            wbg-color: #000000CC;
            w-border: 2px solid;
            w-border-color: #FFFFFFFF;
            w-padding: 12px;
        }

        configuration {
            modi: "drun";
            show-icons: true;
            display-drun: " ";
        }

        listview {
            columns: 1;
            lines: 7;
            fixed-height: true;
            fixed-columns: true;
            cycle: false;
            scrollbar: false;
            border: 0px solid;
        }

        window {
            transparency: "real";
            width: 450px;
            border-radius: @b-radius;
            background-color: @wbg-color;
            border: @w-border;
            border-color: @w-border-color;
            padding: @w-padding;
        }

        prompt {
            text-color: @fg-color;
        }

        inputbar {
            children: ["prompt", "entry"];
            spacing: @g-spacing;
        }

        entry {
            placeholder: "Search Apps";
            text-color: @fg-color;
            placeholder-color: @fgp-color;
        }

        mainbox {
            spacing: @g-spacing;
            margin: @g-margin;
            padding: @g-padding;
            children: ["inputbar", "listview", "message"];
        }

        element {
            spacing: @g-spacing;
            margin: @g-margin;
            padding: @g-padding;
            border: 0px solid;
            border-radius: @b-radius;
            border-color: @b-color;
            background-color: transparent;
            text-color: @fg-color;
        }

        element normal.normal {
          background-color: transparent;
          text-color: @fg-color;
        }

        element alternate.normal {
          background-color: @alt-color;
          text-color: @fg-color;
        }

        element selected.active {
          background-color: @hl-color;
          text-color: @hlt-color;
        }

        element selected.normal {
          background-color: @hl-color;
          text-color: @hlt-color;
        }

        message {
            background-color: red;
            border: 0px solid;
        }
      '';
    };
  };
}
